package game.johan.engine;
/*
Copyright (C) 2013 Johan Ceuppens

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
import java.io.ByteArrayOutputStream;

class GraphicsUtility {

/* Create an ARGB BufferedImage */
/*BufferedImage img = ImageIO.read(imageSrc);
int w = img.getWidth(null);
int h = img.getHeight(null);
BufferedImage bi = new
    BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.getGraphics();
g.drawImage(img, 0, 0, null);
*/
/*
 * Create a rescale filter op that makes the image
 * 50% opaque.
 */
/*float[] scales = { 1f, 1f, 1f, 0.5f };
float[] offsets = new float[4];
RescaleOp rop = new RescaleOp(scales, offsets, null);
*/
/* Draw the image, applying the filter */
/*g2d.drawImage(bi, rop, 0, 0);
*/
/***

boolean Graphics.drawImage(Image img,
                   int x, int y,
                   ImageObserver observer);
 The observer parameter is not frequently used directly and is not needed for the BufferedImage class, so it usually is null.

boolean Graphics.drawImage(Image img,
       int dstx1, int dsty1, int dstx2, int dsty2,
       int srcx1, int srcy1, int srcx2, int srcy2,
       ImageObserver observer);
*/
/* divide the image 'bi' into four rectangular
 * areas and draw each of these areas in to a
 * different part of the image, so as to jumble
 * up the image.  'cells' is an array which has
 * been populated with values which redirect
 * drawing of one subarea to another subarea.
 */
/*int cellWidth = bi.getWidth(null)/2;
int cellHeight = bi.getHeight(null)/2;
for (int x=0; x<2; x++) {
    int sx = x*cellWidth;
    for (int y=0; y<2; y++) {
        int sy = y*cellHeight;
        int cell = cells[x*2+y];
        int dx = (cell / 2) * cellWidth;
        int dy = (cell % 2) * cellHeight;
        g.drawImage(bi,
                    dx, dy, 
                    x+cellWidth, dy+cellHeight,
                    sx, sy,
                    sx+cellWidth, sy+cellHeight,
                    null);
    }
}
void Graphics2D.drawImage(BufferedImage img,
                          BufferedImageOp op,
                          int x, int y)







*/

/***
try {
    // retrieve image
    BufferedImage bi = getMyImage();
    File outputfile = new File("saved.png");
    ImageIO.write(bi, "png", outputfile);
} catch (IOException e) {
    ...
}

***/
/*
BufferedImage off_Image =
  new BufferedImage(100, 50,
                    BufferedImage.TYPE_INT_ARGB);

Graphics2D g2 = off_Image.createGraphics();
*/

/*Object methodCaller(Object theObject, String methodName) {
   return theObject.getClass().getMethod(methodName).invoke(theObject);
   // Catch the exceptions
}
 */
	
public void encode1() {
/*	Bitmap bitmap=BitmapFactory.decodeResource(getResources(), R.drawable.images);
	ByteArrayOutputStream stream=new ByteArrayOutputStream();
    bitmap.compress(Bitmap.CompressFormat.PNG, 90, stream);
    byte[] image=stream.toByteArray();
    System.out.println("byte array:"+image);

    String img_str = Base64.encodeToString(image, 0);
    System.out.println("string:"+img_str);
*/
}

public void initcanvasbmp() {
	/*Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types
	scrbitmap = Bitmap.createBitmap(320, 200, conf); // this creates a MUTABLE bitmap
	canvas = new Canvas(scrbitmap);
	 */
	}
}
